<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body bgcolor="#fffff">
<h1>我的计数器</h1>
<hr />
<form name="form1" action="jisuanqi.jsp">
	请输入第一个数：<input type="text" name="num1"  /><br/><br/>
	请输入运算方式：
	<select name="flag">
				<option value="+">+</option>
				<option value="-">-</option>
				<option value="*">*</option>
				<option value="/">/</option>
		
	</select><br /><br>
	请输入第二个数：<input type="text" name="num2" /><br/><br>
	<input type="submit" value="计算" >
	<input type="reset" value="重置"><br/><br>
	<%
		double num1=0.0;
		double num2=0.0;
		double result=0.0;
	%>
	<%
		String num3=request.getParameter("num1");
		String num4=request.getParameter("num2");
		String flag=request.getParameter("flag");
		if(num3!=null&&num4!=null){
			num1=Double.valueOf(num3);
			num2=Double.valueOf(num4);
			if("+".equals(flag)){
				result=num1+num2;
			}else if("-".equals(flag)){
				result=num1-num2;
			}else if("*".equals(flag)){
				result=num1*num2;
			}else if("/".equals(flag)){
				result=num1/num2;
			}
		}else{
			
		}
		
	%>
	结果：<input type="text" name="result" value="<%=result %>">
	
	
</form>
</body>
</html>